This class is meant as an emulation of SCSlider. last mod: 30-jul-07 sciss
Also refer to JSCView for different behaviour affecting all widgets
| no-op / not working | |
| colors | the track and knob colour cannot be changed |
| different behaviour | |
| actions | fires action when step size is adjusted |
| known issues / todo | |
| size | the slider always has the default width as specified by the look-and-feel |
| knobColor_ | has no effect since we use the default look-and-feel slider and not a custom one |
Note: please use the abstraction layer GUI.slider if possible! (see GUI)
The slider is a general controller for a one-dimensional value. The sliders value is normalized in the range of 0 ... 1 which corresponds to the slider's knob being maximally left / bottom and maximally right / top.
(
w = JSCWindow.new;
b = JSCSlider( w, Rect( 20, 20, 340, 30 ));
// the action function is called whenever the user moves the slider
b.action = { arg butt;
butt.value.postln;
};
w.front;
)
// programmatically set the value (it goes from 0 ... 1 )
b.value = 0.33;
// valueAction_ additionally invokes the action function
// (in this case the value is printed to the post window)
b.valueAction = 0.55;
// step_ can be used to make the slider move in steps on a 'grid'
b.step = 0.2;
b.step = 0.0; // no grid
The slider automatically appears with horizontal or vertical orientation, according to the width-to-height ratio:
b.bounds = b.bounds.resizeTo( 30, 340 );
R | random value |
N | minimum value |
X | maximum value |
C | center value |
csr left/down | decrease value |
csr right/up | increase value |